package com.huawei.appmarket.service.appdetail.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import huawei.widget.HwSubTabWidget;
import o.erq;

public class DetailSubTabWidget extends HwSubTabWidget implements RenderListener {
    private int ˊ;
    private boolean ˋ = false;
    private int ˎ = 0;
    private int ॱ;

    public DetailSubTabWidget(Context context) {
        super(context);
    }

    public DetailSubTabWidget(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public DetailSubTabWidget(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        if (rule.getStyleDeclaration() != null) {
            CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.BACKGROUND_TINT);
            if (propertyValue != null && (propertyValue instanceof CSSMonoColor)) {
                int color = ((CSSMonoColor) propertyValue).getColor();
                ˋ(erq.ˊ(color, 0.75f), color);
                ˏ().setSelectedIndicatorColor(color);
            }
        }
        return false;
    }

    private void ˋ(int i, int i2) {
        this.ॱ = i;
        this.ˊ = i2;
        this.ˋ = true;
        if (ˏ() != null && ˏ().getChildCount() > 0) {
            for (int i3 = 0; i3 < ˏ().getChildCount(); i3++) {
                if (ˏ().getChildAt(i3) instanceof TextView) {
                    TextView textView = (TextView) ˏ().getChildAt(i3);
                    if (i3 == 0) {
                        textView.setTextColor(i2);
                    } else {
                        textView.setTextColor(i);
                    }
                }
            }
        }
    }

    public void setSubTabSelected(int i) {
        super.setSubTabSelected(i);
        if (this.ˋ) {
            if (ˏ().getChildAt(i) instanceof TextView) {
                ((TextView) ˏ().getChildAt(i)).setTextColor(this.ˊ);
            }
            if (ˏ().getChildAt(this.ˎ) instanceof TextView) {
                ((TextView) ˏ().getChildAt(this.ˎ)).setTextColor(this.ॱ);
            }
            this.ˎ = i;
        }
    }
}
